<%@ Page Language="C#" Inherits="Castle.MonoRail.Views.AspView.ViewAtDesignTime" %>
<%@ Import namespace="Neo.Framework"%>
<%@ import namespace="Castle.MonoRail.Framework" %>
<%@ import namespace="System.Collections.Generic" %>
<%@ import namespace="${Rails.Model.Namespace}.Models" %>
<%@ import namespace="${Rails.Model.Namespace}.Controllers.Database" %>
<%@ import namespace="${Rails.Model.Namespace}.Controllers.Helpers" %>
<%@ import namespace="${Rails.Model.Namespace}.Controllers.Resources" %>
#set($entity = $Neo.Entity)
<aspView:properties>
<% 
I${Rails.Entity.ClassName} ${Rails.Entity.ClassName.ToLower()};
Site CurrentSite;
AbstractBaseSmartDispatchController CurrentController; 
MenuHelper MenuHelper;
CustomHtmlHelper CustomHtmlHelper; 
JavaScriptHelper JavaScriptHelper;
${Rails.Entity.ClassName}Helper ${Rails.Entity.ClassName}Helper;
#set($noDups = "")              
#foreach($column in $entity.Attributes)
#set($rel = $entity.RelationshipForAttribute($column))
#if($rel && $rel.Direction.ToString() == "Child")
#if($noDups.Contains(" $rel.ForeignEntity.ClassName.ToLower()s ") == false)
IList ${rel.ForeignEntity.ClassName.ToLower()}s;
#set($noDups = "$noDups $rel.ForeignEntity.ClassName.ToLower()s ") 
#end
#end
#end
%>
</aspView:properties>
<component:MessagesComponent>
</component:MessagesComponent>
<% if (Properties.ContainsKey("${Rails.Entity.ClassName.ToLower()}")) { %>
<%= MenuHelper.CreateCancelLink() %>
<%= this.Helpers.Html.Form(siteRoot + "/${Rails.Entity.ClassName}/Update.ashx", this.Helpers.Dict.CreateDict("method=post", "class=f-wrap-1", "enctype=multipart/form-data", "onsubmit=" + JavaScriptHelper.GetValidationTriggerFunction()) ) %>
<div class="req"><b>*</b> <%=  CommonResource.requiredField  %></div>
<fieldset>
<h3><%=  String.Format(CommonResource.Edit, ${Rails.Entity.ClassName}Resource.${Rails.Entity.ClassName}, ${Rails.Entity.ClassName.ToLower()})  %></h3>
#foreach($attribute in $Rails.Entity.Attributes)
#if($attribute.IsPkColumn || $attribute.IsReadOnly)
    <%= this.Helpers.Html.InputHidden( "${Rails.Entity.ClassName}.${attribute.DotNetName}", ${Rails.Entity.ClassName.ToLower()}.${attribute.DotNetName} )  %>
#end
#end
#foreach($attribute in $Rails.Entity.Attributes)
#set($rel = $Rails.Entity.RelationshipForAttribute($attribute))
#if( ! $attribute.IsHidden && ! $attribute.IsReadOnly && $attribute.Display)
#if($attribute.IsPkColumn || $attribute.IsReadOnly)
    #if($rel && $rel.Direction.ToString() == "Child")
	<label for="${rel.DotNetName}"><b><%= ${Rails.Entity.ClassName}Resource.${attribute.DotNetName} %><%= CustomHtmlHelper.MakeHelpImage("${attribute.DotNetName}", ${Rails.Entity.ClassName}Resource.Help_${attribute.DotNetName}) %></b>
		<%= CustomHtmlHelper.InputReadOnly( "${rel.DotNetName}", ${Rails.Entity.ClassName.ToLower()}.${rel.DotNetName} )  %>    <br />
	#else
	<label for="${attribute.DotNetName}"><b><%= ${Rails.Entity.ClassName}Resource.${attribute.DotNetName} %><%= CustomHtmlHelper.MakeHelpImage("${attribute.DotNetName}", ${Rails.Entity.ClassName}Resource.Help_${attribute.DotNetName}) %></b>
		<%= CustomHtmlHelper.InputReadOnly( "${attribute.DotNetName}", ${Rails.Entity.ClassName.ToLower()}.${attribute.DotNetName} )  %><br />
	#end
	</label>
#elseif( ! $attribute.AllowChanges)
	#if($rel && $rel.Direction.ToString() == "Child")
	<label for="${rel.DotNetName}"><b><%= ${Rails.Entity.ClassName}Resource.${attribute.DotNetName} %><%= CustomHtmlHelper.MakeHelpImage("${attribute.DotNetName}", ${Rails.Entity.ClassName}Resource.Help_${attribute.DotNetName}) %></b>
		<%= CustomHtmlHelper.InputReadOnly( "${rel.DotNetName}", ${Rails.Entity.ClassName.ToLower()}.${rel.DotNetName} )  %>    <%= this.Helpers.Html.InputHidden( "${Rails.Entity.ClassName}.${attribute.DotNetName}", ${Rails.Entity.ClassName.ToLower()}.${attribute.DotNetName} )  %><br />
	#else
	<label for="${attribute.DotNetName}"><b><%= ${Rails.Entity.ClassName}Resource.${attribute.DotNetName} %><%= CustomHtmlHelper.MakeHelpImage("${attribute.DotNetName}", ${Rails.Entity.ClassName}Resource.Help_${attribute.DotNetName}) %></b>
		<%= CustomHtmlHelper.InputReadOnly( "${attribute.DotNetName}", ${Rails.Entity.ClassName.ToLower()}.${attribute.DotNetName} )  %><br />
	#end
	</label>
#elseif($attribute.DotNetType.Equals("System.Boolean"))
	<fieldset class="f-radio-wrap">
		<b>#if($attribute.IsRequired)<span class="req">*</span>#end<%= ${Rails.Entity.ClassName}Resource.${attribute.DotNetName} %><%= CustomHtmlHelper.MakeHelpImage("${attribute.DotNetName}", ${Rails.Entity.ClassName}Resource.Help_${attribute.DotNetName}) %></b>
		<fieldset>
		$HtmlHelpers.GenerateControlWithValue($Rails.Entity, $attribute)
		</fieldset>
	</fieldset>
#elseif($attribute.DotNetType.Equals("System.DateTime"))
	<label for="${Rails.Entity.ClassName}.${attribute.DotNetName}"><b>#if($attribute.IsRequired)<span class="req">*</span>#end<%= ${Rails.Entity.ClassName}Resource.${attribute.DotNetName} %><%= CustomHtmlHelper.MakeHelpImage("${attribute.DotNetName}", ${Rails.Entity.ClassName}Resource.Help_${attribute.DotNetName}) %></b>
		$HtmlHelpers.GenerateControlWithValue($Rails.Entity, $attribute)<br />
	</label>
#else
	<label for="${Rails.Entity.ClassName}.${attribute.DotNetName}"><b>#if($attribute.IsRequired)<span class="req">*</span>#end<%= ${Rails.Entity.ClassName}Resource.${attribute.DotNetName} %><%= CustomHtmlHelper.MakeHelpImage("${attribute.DotNetName}", ${Rails.Entity.ClassName}Resource.Help_${attribute.DotNetName}) %></b>
		$HtmlHelpers.GenerateControlWithValue($Rails.Entity, $attribute)<br />
	</label>
#end
#end
#end
	<div class="f-submit-wrap">
		<input type="submit" name="Submit" id="Submit" value="<%= CommonResource.Save %>" class="f-submit" /><br />
	</div>
</fieldset> 
<%= this.Helpers.Html.EndForm() %>
<%= MenuHelper.CreateCancelLink() %>
<% } %>